import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()

/** 自定义列表刷新事件前缀 */
export const CListEventPrefix = 'CListRefresh_'

/**
 * @description 分页配置默认值
 * @author Elwin ZHANG
 * @date 2023-04-12 13:27
 */
export const Paging = {
  sizes: [10, 15, 30, 50, 100],
  defaultSize: 15
}

/**
 * 日期范围默认值
 */
export const dateShortcuts = [
  {
    text: t('common.lastDay'),
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 1)
      return [start, end]
    }
  },
  {
    text: t('common.lastWeek'),
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    }
  },
  {
    text: t('common.lastMonth'),
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    }
  }
]
